FROM php:7.4.12-fpm-alpine3.12
MAINTAINER <1370808424@qq.com>slpcode
# 安装php扩展
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
#RUN apk add --no-cache tzdata git \
     && apk upgrade \
#RUN apk upgrade \
    && apk add --no-cache tzdata git \
    icu-dev gettext-dev libxml2-dev libzip libzip-dev \
    libmcrypt-dev libjpeg-turbo-dev libpng-dev libwebp libwebp-dev freetype-dev autoconf g++ make \
    openssl openssl-dev \
    && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
    && apk del tzdata

RUN docker-php-ext-install bcmath exif gettext intl pcntl shmop soap sockets sysvmsg sysvsem sysvshm zip iconv pdo_mysql mysqli\
    && docker-php-ext-configure gd --with-freetype=/usr/include/freetype2/ --with-jpeg=/usr/include/ --with-webp=/usr/include/webp \
    && docker-php-ext-install gd

COPY ./ext /tmp/ext

RUN pecl -vvv install /tmp/ext/mongodb-1.13.0.tgz
RUN pecl -vvv install /tmp/ext/swoole-4.8.9.tgz
RUN pecl -vvv install /tmp/ext/redis-5.3.7.tgz
RUN pecl -vvv install /tmp/ext/xdebug-3.1.5.tgz
RUN pecl -vvv install /tmp/ext/xlswriter-1.5.2.tgz

#RUN tar zxvf /tmp/ext/imagick-3.7.0.tgz && ls -al /tmp/ext/
#RUN mv imagick-3.7.0 /usr/src/php/ext/imagick

RUN rm -r /tmp/ext

RUN apk --update add imagemagick \
    && apk add imagemagick-dev

RUN pecl -vvv install imagick

    #&& docker-php-ext-configure imagick --with-imagick=/usr/include/imagick/ \
    #&& docker-php-ext-install imagick
#RUN apk add boost-dev

#RUN curl -fsSL 'https://github.com/swoole/yasd/archive/refs/tags/v0.3.9.tar.gz' -o yasd.tar.gz \
#	&& mkdir -p /tmp/yasd \
#	&& tar -xf yasd.tar.gz -C /tmp/yasd --strip-components=1 \
#	&& rm yasd.tar.gz \
#	&& docker-php-ext-configure /tmp/yasd --enable-yasd \
#	&& docker-php-ext-install /tmp/yasd \
#	&& rm -r /tmp/yasd

#RUN phpize --clean  \
#    && phpize \
#    && ./configure \
#    && make clean \
#    && make \
#    && make install

RUN docker-php-ext-enable imagick
RUN docker-php-ext-enable mongodb
RUN docker-php-ext-enable swoole
RUN docker-php-ext-enable redis
RUN docker-php-ext-enable xlswriter
RUN docker-php-ext-enable xdebug
#RUN docker-php-ext-enable yasd

COPY --from=composer /usr/bin/composer /usr/bin/composer

ENV PATH $PATH:/composer74/vendor/bin
ENV COMPOSER_HOME /composer74

RUN mkdir /composer74 \
    && /usr/bin/composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

RUN apk add supervisor